/*
 * Gedigarr - Falling block game.
 * Copyright (C) 2010  BoredCorp
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
package gedigarr.resources;

/**
 *
 * @author JC
 */
public class GameResource<E> {

  private String source;
  private E resource;
  private int location;
  private int type;
  private int access;
  

  public GameResource( String source ) {
    this( source, ResourceManager.LOC_FS, ResourceManager.TYPE_UNKNOWN, ResourceManager.ACCESS_READONLY );
  }

  public GameResource( String source, int location, int type, int access ) {
    this.source = source;
    this.location = location;
    this.type = type;
    this.access = access;
  }

  public void setResource( E resource ) {
    this.resource = resource;
  }

  public E getResource() {
    return resource;
  }

  public String getString() {
    return source;
  }

  /**
   * 
   * @return Whether or not the write is allowed.
   */
  public boolean writeResource() {
    if ( this.access == ResourceManager.ACCESS_READONLY ) {
      return false;
    }
    return true;
  }
}
